package santiago.domain;

import java.util.HashMap;
import java.util.Map;

public class Bribe {

    private Player Player;
    private Map<Player, Integer> Players;
    private Canal Canal;

    public Bribe(Player Player, int Amount, Canal Canal) {
        this.Player = Player;
        Players.put(Player, Amount);
        this.Canal = Canal;
        Players = new HashMap<>();
    }

    public void addSupportPlayer(Player Player, int Amount) {
        Players.put(Player, Amount);
    }

    public boolean isSupportPlayer(Player Player) {
        if (Player == this.Player) {
            return false;
        }
        return Players.containsKey(Player);
    }

    public int getAmount(Player Player) {
        return Players.get(Player);
    }

    public int getTotalAmount() {
        int TotalAmount = 0;
        for (Map.Entry<Player, Integer> entry : Players.entrySet()) {
            TotalAmount += entry.getValue();
        }
        return TotalAmount;
    }

    public Player getSupportedPlayer() {
        return Player;
    }

    public Player[] getPlayers() {
        return Players.keySet().toArray(new Player[Players.keySet().size()]);
    }

    public int getPlayerCount() {
        return Players.size();
    }

    public Canal getCanal() {
        return Canal;
    }
}
